package org.bambrikii.examples.rutext.lexer.custom;

import org.bambrikii.examples.rutext.lexer.impl.LexerBase;
import org.bambrikii.examples.rutext.parser.IParser;
import org.bambrikii.examples.rutext.parser.ParserException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class WordLexer extends LexerBase<String> {

	private static final Logger logger = LoggerFactory.getLogger(WordLexer.class);

	public WordLexer(IParser parser) {
		super(parser);
	}

	@Override
	public String lex() throws ParserException {
		if (hasNext()) {
			String val = getLast();
			logger.debug("success [" + val + "]");
			consume();
			return val;
		}
		return null;
	}

}
